﻿Imports System.Data
Partial Class WebForm_AssetMaintain_Component_AssetLogDetail
    Inherits BaseUserControl
    Public Sub InitDataAndShow(ByVal asset_serialNo As String, ByVal SeqNo As String)
        GetData(asset_serialNo, SeqNo)
        Me.mpSearch.Show()
    End Sub
    Public Sub GetData(ByVal asset_serialNo As String, ByVal SeqNo As String)
        lblasset_serialNo1.Text = asset_serialNo
        lblSeqNo1.Text = SeqNo
        ddlasset_status.DataBind()

        Dim bbl As AssetManage.BBL.AssetLogBBL = New AssetManage.BBL.AssetLogBBL()
        Dim dt As DataTable = bbl.GetAssetLogDetail(asset_serialNo, SeqNo, hiDBName.Value)
        Dim dr As DataRow = dt.Rows(0)
        ddlassetdef_id.SelectedValue = dr("assetdef_id").ToString().Trim
        txtasset_owner.Text = dr("asset_owner").ToString().Trim
        lblownerName.Text = dr("ownerName").ToString.Trim
        txtEXT.Text = dr("EXT").ToString().Trim
        ddlasset_status.SelectedValue = dr("asset_status").ToString.Trim
        txtDept.Text = dr("Dept").ToString().Trim
        txtMAC1.Text = dr("MAC1").ToString().Trim
        txtMAC2.Text = dr("MAC2").ToString().Trim
        ddlFactory.SelectedValue = dr("Factory").ToString().Trim
        txtClass.Text = dr("Class").ToString().Trim
        txtLocation.Text = dr("Location").ToString().Trim
        txtAsset_Cost.Text = dr("Asset_Cost").ToString.Trim
        Try
            ddlHouseID.SelectedValue = dr("HouseID").ToString().Trim
        Catch ex As Exception

        End Try

        txtComputerName.Text = dr("ComputerName").ToString.Trim
        txtModel.Text = dr("Model").ToString.Trim
        txtCPU.Text = dr("CPU").ToString.Trim
        txtCD_R.Text = dr("CD_R").ToString.Trim
        txtCD_RW.Text = dr("CD_RW").ToString.Trim
        txtRAM.Text = dr("RAM").ToString.Trim
        ddlUsingType.SelectedValue = dr("UsingType").ToString.Trim
        txtOS.Text = dr("OS").ToString.Trim
        txtHDD.Text = dr("HDD").ToString.Trim
        txtMonitorSize.Text = dr("MonitorSize").ToString.Trim
        txtRemark.Text = dr("Remark").ToString.Trim
        txtOtherRemark.Text = dr("OtherRemark").ToString.Trim
        lblCrtName.Text = dr("CrtName").ToString.Trim
        Try
            lblCrtDate1.Text = DateTime.Parse(dr("CrtDate").ToString).ToString("yyyy/MM/dd HH:mm:ss")
        Catch ex As Exception
            lblCrtDate1.Text = ""
        End Try
        lblModiName.Text = dr("ModiName").ToString.Trim
        Try
            lblModiDate1.Text = DateTime.Parse(dr("ModiDate").ToString).ToString("yyyy/MM/dd HH:mm:ss")
        Catch ex As Exception
            lblModiDate1.Text = ""
        End Try
        txtStoreLocation.Text = dr("StoreLocation").ToString.Trim
        txtUser1.Text = dr("User1").ToString.Trim

        ddlUsingType2.SelectedValue = dr("UsingType2").ToString.Trim
        txtPS.Text = dr("PS").ToString.Trim
        ddlStoreHouse.SelectedValue = dr("StoreHouse").ToString.Trim
        txtNBLabel.Text = dr("NBLabel").ToString.Trim()
        txtFDD.Text = dr("FDD").ToString.Trim
        txtUsingDesc.Text = dr("UsingDesc").ToString.Trim
        '訂顏色
        lblassetdef_id.ForeColor = Drawing.Color.Black
        lblasset_owner.ForeColor = Drawing.Color.Black
        lblownerName.ForeColor = Drawing.Color.Black
        lblEXT.ForeColor = Drawing.Color.Black
        lblasset_status.ForeColor = Drawing.Color.Black
        lblDept.ForeColor = Drawing.Color.Black
        lblMAC1.ForeColor = Drawing.Color.Black
        lblMAC2.ForeColor = Drawing.Color.Black
        lblFactory.ForeColor = Drawing.Color.Black
        lblClass.ForeColor = Drawing.Color.Black
        lblLocation.ForeColor = Drawing.Color.Black
        lblAsset_Cost.ForeColor = Drawing.Color.Black
        lblHouseID.ForeColor = Drawing.Color.Black
        lblComputerName.ForeColor = Drawing.Color.Black
        lblModel.ForeColor = Drawing.Color.Black
        lblCPU.ForeColor = Drawing.Color.Black
        lblCD_R.ForeColor = Drawing.Color.Black
        lblCD_RW.ForeColor = Drawing.Color.Black
        lblRAM.ForeColor = Drawing.Color.Black
        lblUsingType.ForeColor = Drawing.Color.Black
        lblOS.ForeColor = Drawing.Color.Black
        lblHDD.ForeColor = Drawing.Color.Black
        lblMonitorSize.ForeColor = Drawing.Color.Black
        lblRemark.ForeColor = Drawing.Color.Black
        lblOtherRemark.ForeColor = Drawing.Color.Black
       
        lblStoreLocation.ForeColor = Drawing.Color.Black
        lblUser1.ForeColor = Drawing.Color.Black

        lblUsingType2.ForeColor = Drawing.Color.Black
        lblPS.ForeColor = Drawing.Color.Black
        lblStoreHouse.ForeColor = Drawing.Color.Black
        lblNBLabel.ForeColor = Drawing.Color.Black
        lblFDD.ForeColor = Drawing.Color.Black

        txtAsset_Cost.ForeColor = Drawing.Color.Black
        ddlassetdef_id.ForeColor = Drawing.Color.Black
        txtasset_owner.ForeColor = Drawing.Color.Black
        lblownerName.ForeColor = Drawing.Color.Black
        txtEXT.ForeColor = Drawing.Color.Black
        ddlasset_status.ForeColor = Drawing.Color.Black
        txtDept.ForeColor = Drawing.Color.Black
        txtMAC1.ForeColor = Drawing.Color.Black
        txtMAC2.ForeColor = Drawing.Color.Black
        ddlFactory.ForeColor = Drawing.Color.Black
        txtClass.ForeColor = Drawing.Color.Black
        txtLocation.ForeColor = Drawing.Color.Black

        ddlHouseID.ForeColor = Drawing.Color.Black
        txtComputerName.ForeColor = Drawing.Color.Black
        txtModel.ForeColor = Drawing.Color.Black
        txtCPU.ForeColor = Drawing.Color.Black
        txtCD_R.ForeColor = Drawing.Color.Black
        txtCD_RW.ForeColor = Drawing.Color.Black
        txtRAM.ForeColor = Drawing.Color.Black
        ddlUsingType.ForeColor = Drawing.Color.Black
        txtOS.ForeColor = Drawing.Color.Black
        txtHDD.ForeColor = Drawing.Color.Black
        txtMonitorSize.ForeColor = Drawing.Color.Black
        txtRemark.ForeColor = Drawing.Color.Black
        txtOtherRemark.ForeColor = Drawing.Color.Black
       
        txtStoreLocation.ForeColor = Drawing.Color.Black
        txtUser1.ForeColor = Drawing.Color.Black

        ddlUsingType2.ForeColor = Drawing.Color.Black
        txtPS.ForeColor = Drawing.Color.Black
        ddlStoreHouse.ForeColor = Drawing.Color.Black
        txtNBLabel.ForeColor = Drawing.Color.Black
        txtFDD.ForeColor = Drawing.Color.Black
        txtUsingDesc.ForeColor = Drawing.Color.Black

        ''異動改紅色
        If (dr("Asset_CostChg").ToString = "Y") Then
            txtAsset_Cost.ForeColor = Drawing.Color.Red
            lblAsset_Cost.ForeColor = Drawing.Color.Red

        End If


        If (dr("assetdef_idChg").ToString = "Y") Then
            ddlassetdef_id.ForeColor = Drawing.Color.Red
            lblassetdef_id.ForeColor = Drawing.Color.Red
        End If

        If (dr("asset_ownerChg").ToString = "Y") Then
            txtasset_owner.ForeColor = Drawing.Color.Red
            lblasset_owner.ForeColor = Drawing.Color.Red
            lblownerName.ForeColor = Drawing.Color.Red
        End If


        If (dr("EXTChg").ToString = "Y") Then
            txtEXT.ForeColor = Drawing.Color.Red
            lblEXT.ForeColor = Drawing.Color.Red
        End If

        If (dr("asset_statusChg").ToString = "Y") Then
            ddlasset_status.ForeColor = Drawing.Color.Red
            lblasset_status.ForeColor = Drawing.Color.Red
        End If
        If (dr("DeptChg").ToString = "Y") Then
            txtDept.ForeColor = Drawing.Color.Red
            lblDept.ForeColor = Drawing.Color.Red
        End If
        If (dr("MAC1Chg").ToString = "Y") Then
            txtMAC1.ForeColor = Drawing.Color.Red
            lblMAC1.ForeColor = Drawing.Color.Red
        End If
        If (dr("MAC2Chg").ToString = "Y") Then
            txtMAC2.ForeColor = Drawing.Color.Red
            lblMAC2.ForeColor = Drawing.Color.Red
        End If
        If (dr("FactoryChg").ToString = "Y") Then
            ddlFactory.ForeColor = Drawing.Color.Red
            lblFactory.ForeColor = Drawing.Color.Red
        End If
        If (dr("ClassChg").ToString = "Y") Then
            txtClass.ForeColor = Drawing.Color.Red
            lblClass.ForeColor = Drawing.Color.Red
        End If
        If (dr("LocationChg").ToString = "Y") Then
            txtLocation.ForeColor = Drawing.Color.Red
            lblLocation.ForeColor = Drawing.Color.Red
        End If
        'If (dr("HouseIDChg").ToString = "Y") Then
        '    ddlHouseID.ForeColor = Drawing.Color.Red
        '    lblHouseID.ForeColor = Drawing.Color.Red
        'End If
        If (dr("ComputerNameChg").ToString = "Y") Then
            txtComputerName.ForeColor = Drawing.Color.Red
            lblComputerName.ForeColor = Drawing.Color.Red
        End If
        If (dr("ModelChg").ToString = "Y") Then
            txtModel.ForeColor = Drawing.Color.Red
            lblModel.ForeColor = Drawing.Color.Red
        End If
        If (dr("CPUChg").ToString = "Y") Then
            txtCPU.ForeColor = Drawing.Color.Red
            lblCPU.ForeColor = Drawing.Color.Red
        End If
        If (dr("CD_RChg").ToString = "Y") Then
            txtCD_R.ForeColor = Drawing.Color.Red
            lblCD_R.ForeColor = Drawing.Color.Red
        End If
        If (dr("CD_RWChg").ToString = "Y") Then
            txtCD_RW.ForeColor = Drawing.Color.Red
            lblCD_RW.ForeColor = Drawing.Color.Red
        End If
        If (dr("RAMChg").ToString = "Y") Then
            txtRAM.ForeColor = Drawing.Color.Red
            lblRAM.ForeColor = Drawing.Color.Red
        End If

        If (dr("UsingTypeChg").ToString = "Y") Then
            ddlUsingType.ForeColor = Drawing.Color.Red
            lblUsingType.ForeColor = Drawing.Color.Red
        End If
        If (dr("OSChg").ToString = "Y") Then
            txtOS.ForeColor = Drawing.Color.Red
            lblOS.ForeColor = Drawing.Color.Red
        End If
        If (dr("HDDChg").ToString = "Y") Then
            txtHDD.ForeColor = Drawing.Color.Red
            lblHDD.ForeColor = Drawing.Color.Red
        End If
        If (dr("MonitorSizeChg").ToString = "Y") Then
            txtMonitorSize.ForeColor = Drawing.Color.Red
            lblMonitorSize.ForeColor = Drawing.Color.Red
        End If
        If (dr("RemarkChg").ToString = "Y") Then
            txtRemark.ForeColor = Drawing.Color.Red
            lblRemark.ForeColor = Drawing.Color.Red
        End If

        If (dr("OtherRemarkChg").ToString = "Y") Then
            txtOtherRemark.ForeColor = Drawing.Color.Red
            lblOtherRemark.ForeColor = Drawing.Color.Red
        End If
        If (dr("StoreLocationChg").ToString = "Y") Then
            txtStoreLocation.ForeColor = Drawing.Color.Red
            lblStoreLocation.ForeColor = Drawing.Color.Red
        End If
        
        If (dr("User1Chg").ToString = "Y") Then
            txtUser1.ForeColor = Drawing.Color.Red
            lblUser1.ForeColor = Drawing.Color.Red
        End If

        If (dr("UsingType2Chg").ToString = "Y") Then
            ddlUsingType2.ForeColor = Drawing.Color.Red
            lblUsingType2.ForeColor = Drawing.Color.Red
            txtUsingDesc.ForeColor = Drawing.Color.Red
        End If
        If (dr("PSChg").ToString = "Y") Then
            txtPS.ForeColor = Drawing.Color.Red
            lblPS.ForeColor = Drawing.Color.Red
        End If
        If (dr("StoreHouseChg").ToString = "Y") Then
            ddlStoreHouse.ForeColor = Drawing.Color.Red
            lblStoreHouse.ForeColor = Drawing.Color.Red
        End If
        If (dr("NBLabelChg").ToString = "Y") Then
            txtNBLabel.ForeColor = Drawing.Color.Red
            lblNBLABEL.ForeColor = Drawing.Color.Red
        End If
        If (dr("FDDChg").ToString = "Y") Then
            txtFDD.ForeColor = Drawing.Color.Red
            lblFDD.ForeColor = Drawing.Color.Red
        End If

        If (dr("NBLabelChg").ToString = "Y") Then
            txtNBLabel.ForeColor = Drawing.Color.Red
            lblNBLABEL.ForeColor = Drawing.Color.Red
        End If
       



    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hiDBName.Value = dbName
            hiUID.Value = ActualUID

        End If
    End Sub

    Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click

    End Sub
End Class
